home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 3584 < prev    next >
Mailbox/MIME Entity  |  1996-08-05  |  3.9 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: Mailbox/MIME Entity (archive/mbox).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert Mailbox/MIME Entity (archive/mbox) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file C source text default
99% file C source, ASCII text default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/950 MIME Email (1.0) default
100% detectItEasy Format: plain text[LF] default (weak)



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 4e 65 77 73 67 72 6f 75 | 70 73 3a 20 63 6f 6d 70 |Newsgrou|ps: comp|
|00000010| 2e 6c 61 6e 67 2e 63 0a | 50 61 74 68 3a 20 69 6e |.lang.c.|Path: in|
|00000020| 32 2e 75 75 2e 6e 65 74 | 21 62 63 73 74 65 63 21 |2.uu.net|!bcstec!|
|00000030| 6e 6e 74 70 0a 46 72 6f | 6d 3a 20 4b 65 76 69 6e |nntp.Fro|m: Kevin|
|00000040| 20 49 6e 67 61 6c 6c 73 | 20 3c 69 6e 67 6b 6c 39 | Ingalls| <ingkl9|
|00000050| 30 30 40 63 63 6d 61 69 | 6c 2e 63 61 2e 62 6f 65 |00@ccmai|l.ca.boe|
|00000060| 69 6e 67 2e 63 6f 6d 3e | 0a 53 75 62 6a 65 63 74 |ing.com>|.Subject|
|00000070| 3a 20 52 65 3a 20 48 65 | 6c 70 20 75 73 69 6e 67 |: Re: He|lp using|
|00000080| 20 71 73 6f 72 74 20 74 | 6f 20 73 6f 72 74 20 70 | qsort t|o sort p|
|00000090| 6f 69 6e 74 65 72 73 20 | 74 6f 20 61 20 73 74 72 |ointers |to a str|
|000000a0| 75 63 74 75 72 65 0a 58 | 2d 4e 6e 74 70 2d 50 6f |ucture.X|-Nntp-Po|
|000000b0| 73 74 69 6e 67 2d 48 6f | 73 74 3a 20 31 33 37 2e |sting-Ho|st: 137.|
|000000c0| 31 33 36 2e 31 36 2e 31 | 34 39 0a 43 6f 6e 74 65 |136.16.1|49.Conte|
|000000d0| 6e 74 2d 54 79 70 65 3a | 20 74 65 78 74 2f 70 6c |nt-Type:| text/pl|
|000000e0| 61 69 6e 3b 20 63 68 61 | 72 73 65 74 3d 75 73 2d |ain; cha|rset=us-|
|000000f0| 61 73 63 69 69 0a 4d 65 | 73 73 61 67 65 2d 49 44 |ascii.Me|ssage-ID|
|00000100| 3a 20 3c 44 4c 79 78 70 | 43 2e 47 37 71 40 62 63 |: <DLyxp|C.G7q@bc|
|00000110| 73 74 65 63 2e 63 61 2e | 62 6f 65 69 6e 67 2e 63 |stec.ca.|boeing.c|
|00000120| 6f 6d 3e 0a 54 6f 3a 20 | 72 69 70 72 40 63 74 73 |om>.To: |ripr@cts|
|00000130| 2e 63 6f 6d 0a 53 65 6e | 64 65 72 3a 20 6e 6e 74 |.com.Sen|der: nnt|
|00000140| 70 40 62 63 73 74 65 63 | 2e 63 61 2e 62 6f 65 69 |p@bcstec|.ca.boei|
|00000150| 6e 67 2e 63 6f 6d 20 28 | 4e 4e 54 50 20 4e 65 77 |ng.com (|NNTP New|
|00000160| 73 20 41 63 63 65 73 73 | 29 0a 43 6f 6e 74 65 6e |s Access|).Conten|
|00000170| 74 2d 54 72 61 6e 73 66 | 65 72 2d 45 6e 63 6f 64 |t-Transf|er-Encod|
|00000180| 69 6e 67 3a 20 37 62 69 | 74 0a 4f 72 67 61 6e 69 |ing: 7bi|t.Organi|
|00000190| 7a 61 74 69 6f 6e 3a 20 | 42 6f 65 69 6e 67 20 44 |zation: |Boeing D|
|000001a0| 65 66 65 6e 73 65 20 26 | 20 53 70 61 63 65 20 47 |efense &| Space G|
|000001b0| 72 6f 75 70 20 54 72 61 | 69 6e 69 6e 67 0a 52 65 |roup Tra|ining.Re|
|000001c0| 66 65 72 65 6e 63 65 73 | 3a 20 3c 34 65 67 38 72 |ferences|: <4eg8r|
|000001d0| 70 24 32 6f 6f 5f 30 30 | 31 40 6e 65 77 73 32 2e |p$2oo_00|1@news2.|
|000001e0| 63 74 73 2e 63 6f 6d 3e | 0a 4d 69 6d 65 2d 56 65 |cts.com>|.Mime-Ve|
|000001f0| 72 73 69 6f 6e 3a 20 31 | 2e 30 0a 44 61 74 65 3a |rsion: 1|.0.Date:|
|00000200| 20 54 75 65 2c 20 33 30 | 20 4a 61 6e 20 31 39 39 | Tue, 30| Jan 199|
|00000210| 36 20 30 30 3a 33 36 3a | 34 38 20 47 4d 54 0a 58 |6 00:36:|48 GMT.X|
|00000220| 2d 4d 61 69 6c 65 72 3a | 20 4d 6f 7a 69 6c 6c 61 |-Mailer:| Mozilla|
|00000230| 20 31 2e 31 4e 20 28 4d | 61 63 69 6e 74 6f 73 68 | 1.1N (M|acintosh|
|00000240| 3b 20 49 3b 20 50 50 43 | 29 0a 58 2d 55 72 6c 3a |; I; PPC|).X-Url:|
|00000250| 20 6e 65 77 73 3a 34 65 | 67 38 72 70 24 32 6f 6f | news:4e|g8rp$2oo|
|00000260| 5f 30 30 31 40 6e 65 77 | 73 32 2e 63 74 73 2e 63 |_001@new|s2.cts.c|
|00000270| 6f 6d 0a 0a 72 69 70 72 | 40 63 74 73 2e 63 6f 6d |om..ripr|@cts.com|
|00000280| 20 28 57 69 6c 6c 69 61 | 6d 20 52 69 6e 65 68 61 | (Willia|m Rineha|
|00000290| 72 74 29 20 77 72 6f 74 | 65 3a 0a 3e 49 27 6d 20 |rt) wrot|e:.>I'm |
|000002a0| 74 72 79 69 6e 67 20 74 | 6f 20 75 73 65 20 71 73 |trying t|o use qs|
|000002b0| 6f 72 74 20 74 6f 20 73 | 6f 72 74 20 74 68 65 20 |ort to s|ort the |
|000002c0| 22 6e 61 6d 65 73 22 20 | 65 6c 65 6d 65 6e 74 73 |"names" |elements|
|000002d0| 20 69 6e 20 74 68 65 20 | 73 74 72 75 63 74 75 72 | in the |structur|
|000002e0| 65 20 63 61 6c 6c 65 64 | 20 22 64 61 74 61 22 2e |e called| "data".|
|000002f0| 20 20 0a 3e 54 68 65 20 | 63 6f 64 65 20 62 65 6c | .>The |code bel|
|00000300| 6f 77 20 63 6f 6d 70 69 | 6c 65 73 20 77 69 74 68 |ow compi|les with|
|00000310| 20 6e 6f 20 65 72 72 6f | 72 73 20 6f 72 20 77 61 | no erro|rs or wa|
|00000320| 72 6e 69 6e 67 73 2c 20 | 62 75 74 20 47 50 46 73 |rnings, |but GPFs|
|00000330| 20 28 73 65 67 6d 65 6e | 74 61 74 69 6f 6e 20 66 | (segmen|tation f|
|00000340| 61 75 6c 74 20 6f 6e 20 | 61 0a 3e 55 4e 49 58 20 |ault on |a.>UNIX |
|00000350| 62 6f 78 29 20 77 68 65 | 6e 20 69 74 20 69 73 20 |box) whe|n it is |
|00000360| 72 75 6e 2e 20 20 41 70 | 70 61 72 65 6e 74 6c 79 |run. Ap|parently|
|00000370| 20 74 68 65 20 66 61 75 | 6c 74 20 69 73 20 69 6e | the fau|lt is in|
|00000380| 20 74 68 65 20 73 74 72 | 63 6d 70 20 63 61 6c 6c | the str|cmp call|
|00000390| 2e 20 20 49 20 64 6f 6e | 27 74 20 73 65 65 20 0a |. I don|'t see .|
|000003a0| 3e 77 68 61 74 27 73 20 | 77 72 6f 6e 67 20 77 69 |>what's |wrong wi|
|000003b0| 74 68 20 69 74 2e 20 20 | 43 61 6e 20 61 6e 79 6f |th it. |Can anyo|
|000003c0| 6e 65 20 68 65 6c 70 3f | 0a 3e 0a 3e 54 68 61 6e |ne help?|.>.>Than|
|000003d0| 6b 73 21 0a 3e 0a 5b 63 | 6f 64 65 20 72 65 6d 6f |ks!.>.[c|ode remo|
|000003e0| 76 65 64 2c 20 6d 79 20 | 6d 6f 64 69 66 69 63 61 |ved, my |modifica|
|000003f0| 74 69 6f 6e 20 74 6f 20 | 66 6f 6c 6c 6f 77 20 2e |tion to |follow .|
|00000400| 2e 2e 5d 0a 0a 57 65 6c | 6c 2c 20 74 68 65 72 65 |..]..Wel|l, there|
|00000410| 20 61 72 65 20 61 20 63 | 6f 75 70 6c 65 20 61 20 | are a c|ouple a |
|00000420| 70 72 6f 62 6c 65 6d 73 | 20 68 65 72 65 3a 20 6f |problems| here: o|
|00000430| 6e 65 20 74 68 61 74 20 | 77 69 6c 6c 20 6d 61 6b |ne that |will mak|
|00000440| 65 20 79 6f 75 20 67 6f | 0a 22 41 52 52 47 47 21 |e you go|."ARRGG!|
|00000450| 20 49 20 63 61 6e 27 74 | 20 62 65 6c 69 65 76 65 | I can't| believe|
|00000460| 20 49 20 6d 69 73 73 65 | 64 20 74 68 61 74 21 22 | I misse|d that!"|
|00000470| 20 77 68 65 6e 20 69 74 | 20 69 73 20 70 6f 69 6e | when it| is poin|
|00000480| 74 65 64 20 6f 75 74 2c | 0a 61 6e 64 20 6f 6e 65 |ted out,|.and one|
|00000490| 20 74 68 61 74 20 69 73 | 20 6d 6f 72 65 20 63 6f | that is| more co|
|000004a0| 6d 70 6c 65 78 2e 0a 0a | 31 29 0a 3e 20 09 66 6f |mplex...|1).> .fo|
|000004b0| 72 20 28 69 3d 30 3b 20 | 69 20 3c 20 34 3b 20 69 |r (i=0; |i < 4; i|
|000004c0| 2b 2b 29 20 20 2f 2a 20 | 70 72 69 6e 74 20 73 6f |++) /* |print so|
|000004d0| 72 74 65 64 20 6c 69 73 | 74 20 2a 2f 0a 3e 09 09 |rted lis|t */.>..|
|000004e0| 70 72 69 6e 74 66 28 22 | 25 73 5c 6e 22 2c 69 2c |printf("|%s\n",i,|
|000004f0| 20 64 61 74 61 5b 69 5d | 2e 6e 61 6d 65 73 29 3b | data[i]|.names);|
|00000500| 20 0a 0a 54 68 65 20 70 | 72 69 6e 74 66 20 66 6f | ..The p|rintf fo|
|00000510| 72 6d 61 74 20 73 74 72 | 69 6e 67 20 63 61 6c 6c |rmat str|ing call|
|00000520| 73 20 66 6f 72 20 2a 6f | 6e 65 2a 20 70 61 72 61 |s for *o|ne* para|
|00000530| 6d 65 74 65 72 2c 20 61 | 6e 64 20 79 6f 75 20 68 |meter, a|nd you h|
|00000540| 61 76 65 20 0a 73 75 70 | 70 6c 69 65 64 20 2a 74 |ave .sup|plied *t|
|00000550| 77 6f 2a 2e 20 54 68 65 | 20 63 6f 6d 70 69 6c 65 |wo*. The| compile|
|00000560| 72 20 77 69 6c 6c 20 63 | 6f 6d 70 69 6c 65 20 74 |r will c|ompile t|
|00000570| 68 69 73 2c 20 61 6e 64 | 20 74 68 65 20 6c 69 6e |his, and| the lin|
|00000580| 6b 65 72 20 77 69 6c 6c | 0a 6c 69 6e 6b 20 69 74 |ker will|.link it|
|00000590| 2c 20 62 65 63 61 75 73 | 65 20 69 74 20 69 73 20 |, becaus|e it is |
|000005a0| 6c 65 67 61 6c 20 73 79 | 6e 74 61 78 2e 20 48 6f |legal sy|ntax. Ho|
|000005b0| 77 65 76 65 72 2c 20 61 | 74 20 72 75 6e 2d 74 69 |wever, a|t run-ti|
|000005c0| 6d 65 20 2e 2e 2e 20 5b | 49 20 0a 73 75 73 70 65 |me ... [|I .suspe|
|000005d0| 63 74 20 79 6f 75 20 6b | 6e 6f 77 20 74 68 65 20 |ct you k|now the |
|000005e0| 72 65 73 74 20 3a 29 20 | 5d 0a 0a 32 29 0a 3e 09 |rest :) |]..2).>.|
|000005f0| 2f 2a 20 63 61 73 74 20 | 61 72 67 31 20 61 6e 64 |/* cast |arg1 and|
|00000600| 20 61 72 67 32 20 61 73 | 20 70 6f 69 6e 74 65 72 | arg2 as| pointer|
|00000610| 73 20 74 6f 20 70 6f 69 | 6e 74 65 72 73 2c 20 74 |s to poi|nters, t|
|00000620| 68 65 6e 20 64 65 72 65 | 66 65 6e 63 65 0a 3e 09 |hen dere|fence.>.|
|00000630| 09 73 6f 20 74 68 61 74 | 20 73 74 72 63 6d 70 20 |.so that| strcmp |
|00000640| 67 65 74 73 20 22 72 65 | 67 75 6c 61 72 22 20 70 |gets "re|gular" p|
|00000650| 6f 69 6e 74 65 72 20 61 | 73 20 61 72 67 75 6d 65 |ointer a|s argume|
|00000660| 6e 74 73 20 2a 2f 0a 3e | 20 20 20 09 72 65 74 75 |nts */.>| .retu|
|00000670| 72 6e 20 28 73 74 72 63 | 6d 70 28 28 2a 28 73 74 |rn (strc|mp((*(st|
|00000680| 72 75 63 74 20 61 6c 70 | 68 61 2a 2a 29 61 72 67 |ruct alp|ha**)arg|
|00000690| 31 29 2d 3e 6e 61 6d 65 | 73 2c 20 28 2a 28 73 74 |1)->name|s, (*(st|
|000006a0| 72 75 63 74 20 61 6c 70 | 68 61 2a 2a 29 61 72 67 |ruct alp|ha**)arg|
|000006b0| 32 29 2d 3e 6e 61 6d 65 | 73 29 29 3b 0a 0a 49 20 |2)->name|s));..I |
|000006c0| 74 68 69 6e 6b 20 74 68 | 61 74 20 79 6f 75 20 68 |think th|at you h|
|000006d0| 61 76 65 20 74 68 65 20 | 77 72 6f 6e 67 20 64 61 |ave the |wrong da|
|000006e0| 74 61 74 79 70 65 20 66 | 6f 72 20 61 72 67 31 20 |tatype f|or arg1 |
|000006f0| 61 6e 64 20 61 72 67 32 | 2e 20 54 68 65 20 64 61 |and arg2|. The da|
|00000700| 74 61 74 79 70 65 0a 66 | 6f 72 20 61 72 67 31 20 |tatype.f|or arg1 |
|00000710| 61 6e 64 20 61 72 67 32 | 20 69 6e 20 74 68 69 73 |and arg2| in this|
|00000720| 20 63 61 73 65 20 69 73 | 20 28 73 74 72 75 63 74 | case is| (struct|
|00000730| 20 61 6c 70 68 61 20 2a | 29 2c 20 6e 6f 74 20 0a | alpha *|), not .|
|00000740| 28 73 74 72 75 63 74 20 | 61 6c 70 68 61 20 2a 2a |(struct |alpha **|
|00000750| 29 20 61 73 20 79 6f 75 | 20 69 6e 64 69 63 61 74 |) as you| indicat|
|00000760| 65 2e 20 54 68 69 73 20 | 69 73 20 62 65 63 61 75 |e. This |is becau|
|00000770| 73 65 20 77 68 61 74 20 | 69 73 20 75 73 65 64 20 |se what |is used |
|00000780| 69 6e 73 69 64 65 0a 6f | 66 20 71 73 6f 72 74 20 |inside.o|f qsort |
|00000790| 69 73 20 61 20 70 6f 69 | 6e 74 65 72 20 74 6f 20 |is a poi|nter to |
|000007a0| 65 61 63 68 20 65 6c 65 | 6d 65 6e 74 20 74 6f 20 |each ele|ment to |
|000007b0| 62 65 20 73 6f 72 74 65 | 64 2c 20 61 6e 64 20 65 |be sorte|d, and e|
|000007c0| 61 63 68 20 65 6c 65 6d | 65 6e 74 0a 74 6f 20 62 |ach elem|ent.to b|
|000007d0| 65 20 73 6f 72 74 65 64 | 20 69 6e 20 74 68 69 73 |e sorted| in this|
|000007e0| 20 63 61 73 65 20 69 73 | 20 61 20 73 74 72 75 63 | case is| a struc|
|000007f0| 74 2c 20 6e 6f 74 20 61 | 20 70 6f 69 6e 74 65 72 |t, not a| pointer|
|00000800| 20 74 6f 20 61 20 73 74 | 72 75 63 74 2e 0a 0a 41 | to a st|ruct...A|
|00000810| 20 72 65 6c 61 74 65 64 | 20 70 72 6f 62 6c 65 6d | related| problem|
|00000820| 20 77 69 74 68 20 74 68 | 65 20 63 6f 64 65 20 69 | with th|e code i|
|00000830| 73 20 73 65 65 6e 20 69 | 6e 20 74 68 65 20 63 61 |s seen i|n the ca|
|00000840| 6c 6c 20 74 6f 20 71 73 | 6f 72 74 3a 0a 0a 3e 71 |ll to qs|ort:..>q|
|00000850| 73 6f 72 74 28 28 76 6f | 69 64 20 2a 29 64 61 74 |sort((vo|id *)dat|
|00000860| 61 2c 20 28 73 69 7a 65 | 5f 74 29 34 2c 20 73 69 |a, (size|_t)4, si|
|00000870| 7a 65 6f 66 28 73 74 72 | 75 63 74 20 61 6c 70 68 |zeof(str|uct alph|
|00000880| 61 20 2a 29 2c 20 63 6f | 6d 70 6e 61 6d 65 29 3b |a *), co|mpname);|
|00000890| 0a 0a 54 68 65 20 65 6c | 65 6d 65 6e 74 73 20 62 |..The el|ements b|
|000008a0| 65 69 6e 67 20 73 6f 72 | 74 65 64 20 61 72 65 20 |eing sor|ted are |
|000008b0| 28 73 74 72 75 63 74 20 | 61 6c 70 68 61 29 73 2c |(struct |alpha)s,|
|000008c0| 20 6e 6f 74 20 28 73 74 | 72 75 63 74 20 61 6c 70 | not (st|ruct alp|
|000008d0| 68 61 20 2a 29 73 2c 0a | 73 6f 20 74 68 65 20 74 |ha *)s,.|so the t|
|000008e0| 68 69 72 64 20 70 61 72 | 61 6d 65 74 65 72 20 69 |hird par|ameter i|
|000008f0| 73 20 77 72 6f 6e 67 2e | 0a 0a 48 65 72 65 20 69 |s wrong.|..Here i|
|00000900| 73 20 79 6f 75 72 20 63 | 6f 64 65 20 77 69 74 68 |s your c|ode with|
|00000910| 20 61 20 6c 69 74 74 6c | 65 20 63 6f 72 72 65 63 | a littl|e correc|
|00000920| 74 69 6f 6e 3a 0a 0a 23 | 69 6e 63 6c 75 64 65 20 |tion:..#|include |
|00000930| 3c 73 74 64 69 6f 2e 68 | 3e 0a 23 69 6e 63 6c 75 |<stdio.h|>.#inclu|
|00000940| 64 65 20 3c 73 74 64 6c | 69 62 2e 68 3e 0a 23 69 |de <stdl|ib.h>.#i|
|00000950| 6e 63 6c 75 64 65 20 3c | 73 74 72 69 6e 67 2e 68 |nclude <|string.h|
|00000960| 3e 0a 0a 73 74 72 75 63 | 74 20 61 6c 70 68 61 20 |>..struc|t alpha |
|00000970| 7b 0a 20 20 20 20 20 20 | 20 20 63 68 61 72 20 6e |{. | char n|
|00000980| 61 6d 65 73 5b 32 30 5d | 3b 0a 7d 3b 0a 0a 73 74 |ames[20]|;.};..st|
|00000990| 72 75 63 74 20 61 6c 70 | 68 61 20 64 61 74 61 5b |ruct alp|ha data[|
|000009a0| 34 5d 3d 0a 20 20 20 20 | 20 20 20 20 7b 20 7b 22 |4]=. | { {"|
|000009b0| 62 62 62 22 7d 2c 20 7b | 22 61 61 61 22 7d 2c 20 |bbb"}, {|"aaa"}, |
|000009c0| 7b 22 64 64 64 22 7d 2c | 20 7b 22 63 63 63 22 7d |{"ddd"},| {"ccc"}|
|000009d0| 20 7d 3b 0a 0a 69 6e 74 | 20 63 6f 6d 70 6e 61 6d | };..int| compnam|
|000009e0| 65 28 63 6f 6e 73 74 20 | 76 6f 69 64 20 2a 61 72 |e(const |void *ar|
|000009f0| 67 31 2c 20 63 6f 6e 73 | 74 20 76 6f 69 64 20 2a |g1, cons|t void *|
|00000a00| 61 72 67 32 29 3b 0a 0a | 69 6e 74 0a 6d 61 69 6e |arg2);..|int.main|
|00000a10| 28 76 6f 69 64 29 0a 7b | 0a 20 0a 20 20 20 20 69 |(void).{|. . i|
|00000a20| 6e 74 20 69 3b 0a 20 20 | 20 20 20 20 20 20 20 20 |nt i;. | |
|00000a30| 20 20 20 20 20 20 0a 20 | 20 20 20 20 20 20 20 66 | . | f|
|00000a40| 6f 72 20 28 69 3d 30 3b | 20 69 20 3c 20 34 3b 20 |or (i=0;| i < 4; |
|00000a50| 69 2b 2b 29 20 20 2f 2a | 20 70 72 69 6e 74 20 70 |i++) /*| print p|
|00000a60| 72 65 2d 73 6f 72 74 20 | 6c 69 73 74 20 2a 2f 0a |re-sort |list */.|
|00000a70| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000a80| 70 72 69 6e 74 66 28 22 | 25 73 5c 6e 22 2c 64 61 |printf("|%s\n",da|
|00000a90| 74 61 5b 69 5d 2e 6e 61 | 6d 65 73 29 3b 0a 20 20 |ta[i].na|mes);. |
|00000aa0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000ab0| 20 20 20 20 20 20 0a 09 | 09 09 09 09 09 09 09 71 | ..|.......q|
|00000ac0| 73 6f 72 74 28 28 76 6f | 69 64 20 2a 29 64 61 74 |sort((vo|id *)dat|
|00000ad0| 61 2c 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |a, | |
|00000ae0| 20 20 2f 2a 20 61 64 64 | 72 65 73 73 20 6f 66 20 | /* add|ress of |
|00000af0| 66 69 72 73 74 20 65 6c | 65 6d 65 6e 74 2a 2f 0a |first el|ement*/.|
|00000b00| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 73 69 | | si|
|00000b10| 7a 65 6f 66 28 64 61 74 | 61 29 2f 73 69 7a 65 6f |zeof(dat|a)/sizeo|
|00000b20| 66 28 64 61 74 61 5b 30 | 5d 29 2c 20 2f 2a 20 6e |f(data[0|]), /* n|
|00000b30| 75 6d 62 65 72 20 6f 66 | 20 65 6c 65 6d 65 6e 74 |umber of| element|
|00000b40| 73 20 2a 2f 0a 20 20 20 | 20 20 20 20 20 20 20 20 |s */. | |
|00000b50| 20 20 20 73 69 7a 65 6f | 66 28 64 61 74 61 5b 30 | sizeo|f(data[0|
|00000b60| 5d 29 2c 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |]), | |
|00000b70| 20 2f 2a 20 73 69 7a 65 | 6f 66 20 65 61 63 68 20 | /* size|of each |
|00000b80| 65 6c 65 6d 65 6e 74 20 | 2a 2f 0a 20 20 20 20 20 |element |*/. |
|00000b90| 20 20 20 20 20 20 20 20 | 20 63 6f 6d 70 6e 61 6d | | compnam|
|00000ba0| 65 29 3b 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |e); | |
|00000bb0| 20 20 20 20 20 20 20 2f | 2a 20 72 6f 75 74 69 6e | /|* routin|
|00000bc0| 65 20 74 6f 20 73 6f 72 | 74 20 61 6c 70 68 61 73 |e to sor|t alphas|
|00000bd0| 20 2a 2f 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 | */. | |
|00000be0| 20 20 20 20 20 20 20 20 | 20 20 20 20 0a 20 20 20 | | . |
|00000bf0| 20 20 20 20 20 66 6f 72 | 20 28 69 3d 30 3b 20 69 | for| (i=0; i|
|00000c00| 20 3c 20 34 3b 20 69 2b | 2b 29 20 20 2f 2a 20 70 | < 4; i+|+) /* p|
|00000c10| 72 69 6e 74 20 73 6f 72 | 74 65 64 20 6c 69 73 74 |rint sor|ted list|
|00000c20| 20 2a 2f 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 | */. | |
|00000c30| 20 20 20 20 70 72 69 6e | 74 66 28 22 25 73 5c 6e | prin|tf("%s\n|
|00000c40| 22 2c 20 64 61 74 61 5b | 69 5d 2e 6e 61 6d 65 73 |", data[|i].names|
|00000c50| 29 3b 0a 20 20 20 20 20 | 20 20 20 72 65 74 75 72 |);. | retur|
|00000c60| 6e 28 30 29 3b 0a 7d 0a | 0a 69 6e 74 0a 63 6f 6d |n(0);.}.|.int.com|
|00000c70| 70 6e 61 6d 65 28 63 6f | 6e 73 74 20 76 6f 69 64 |pname(co|nst void|
|00000c80| 20 2a 61 72 67 31 2c 20 | 63 6f 6e 73 74 20 76 6f | *arg1, |const vo|
|00000c90| 69 64 20 2a 61 72 67 32 | 29 0a 7b 0a 20 20 20 20 |id *arg2|).{. |
|00000ca0| 20 20 20 20 2f 2a 20 63 | 61 73 74 20 61 72 67 31 | /* c|ast arg1|
|00000cb0| 20 61 6e 64 20 61 72 67 | 32 20 61 73 20 70 6f 69 | and arg|2 as poi|
|00000cc0| 6e 74 65 72 73 20 74 6f | 20 70 6f 69 6e 74 65 72 |nters to| pointer|
|00000cd0| 73 2c 20 74 68 65 6e 20 | 64 65 72 65 66 65 6e 63 |s, then |derefenc|
|00000ce0| 65 0a 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |e. | |
|00000cf0| 20 20 73 6f 20 74 68 61 | 74 20 73 74 72 63 6d 70 | so tha|t strcmp|
|00000d00| 20 67 65 74 73 20 22 72 | 65 67 75 6c 61 72 22 20 | gets "r|egular" |
|00000d10| 70 6f 69 6e 74 65 72 20 | 61 73 20 61 72 67 75 6d |pointer |as argum|
|00000d20| 65 6e 74 73 20 2a 2f 0a | 0a 20 20 20 20 20 20 20 |ents */.|. |
|00000d30| 2f 2a 20 6e 6f 74 65 20 | 74 68 65 20 63 68 61 6e |/* note |the chan|
|00000d40| 67 65 20 74 6f 20 74 68 | 65 20 74 79 70 65 63 61 |ge to th|e typeca|
|00000d50| 73 74 2c 20 61 6e 64 20 | 72 65 6d 65 6d 62 65 72 |st, and |remember|
|00000d60| 20 74 68 61 74 0a 20 20 | 20 20 20 20 20 20 20 20 | that. | |
|00000d70| 74 68 65 20 64 61 74 61 | 74 79 70 65 20 6f 66 20 |the data|type of |
|00000d80| 74 68 65 20 76 61 6c 75 | 65 20 6f 66 20 22 64 61 |the valu|e of "da|
|00000d90| 74 61 22 20 61 62 6f 76 | 65 20 69 73 20 74 68 65 |ta" abov|e is the|
|00000da0| 20 73 61 6d 65 20 61 73 | 0a 20 20 20 20 20 20 20 | same as|. |
|00000db0| 20 20 20 74 68 65 20 64 | 61 74 61 74 79 70 65 20 | the d|atatype |
|00000dc0| 6f 66 20 61 72 67 31 20 | 61 6e 64 20 61 72 67 32 |of arg1 |and arg2|
|00000dd0| 20 28 69 2e 65 2e 2c 20 | 70 6f 69 6e 74 65 72 20 | (i.e., |pointer |
|00000de0| 74 6f 20 61 6c 70 68 61 | 29 20 2a 2f 0a 20 20 20 |to alpha|) */. |
|00000df0| 20 20 20 20 20 72 65 74 | 75 72 6e 20 73 74 72 63 | ret|urn strc|
|00000e00| 6d 70 28 20 28 28 73 74 | 72 75 63 74 20 61 6c 70 |mp( ((st|ruct alp|
|00000e10| 68 61 2a 29 61 72 67 31 | 29 2d 3e 6e 61 6d 65 73 |ha*)arg1|)->names|
|00000e20| 2c 20 20 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 |, . | |
|00000e30| 20 20 20 20 20 20 20 20 | 20 20 20 20 28 28 73 74 | | ((st|
|00000e40| 72 75 63 74 20 61 6c 70 | 68 61 2a 29 61 72 67 32 |ruct alp|ha*)arg2|
|00000e50| 29 2d 3e 6e 61 6d 65 73 | 29 3b 0a 7d 0a 0a 43 6f |)->names|);.}..Co|
|00000e60| 6d 70 6c 65 78 20 64 61 | 74 61 74 79 70 65 73 20 |mplex da|tatypes |
|00000e70| 69 6e 20 43 20 61 72 65 | 20 74 72 69 63 6b 79 20 |in C are| tricky |
|00000e80| 74 68 69 6e 67 73 2e 20 | 49 74 20 6d 61 79 20 73 |things. |It may s|
|00000e90| 6f 75 6e 64 20 64 75 6d | 62 2c 20 62 75 74 20 49 |ound dum|b, but I|
|00000ea0| 0a 61 6c 77 61 79 73 20 | 64 72 61 77 20 70 69 63 |.always |draw pic|
|00000eb0| 74 75 72 65 73 20 6f 66 | 20 74 68 65 20 73 74 72 |tures of| the str|
|00000ec0| 75 63 74 75 72 65 20 6f | 66 20 74 68 65 20 64 61 |ucture o|f the da|
|00000ed0| 74 61 20 77 68 65 6e 20 | 49 20 61 6d 20 74 72 79 |ta when |I am try|
|00000ee0| 69 6e 67 20 0a 74 6f 20 | 66 69 67 75 72 65 20 6f |ing .to |figure o|
|00000ef0| 75 74 20 77 68 61 74 20 | 69 73 20 68 61 70 70 65 |ut what |is happe|
|00000f00| 6e 69 6e 67 2e 0a 0a 48 | 6f 70 65 20 74 68 69 73 |ning...H|ope this|
|00000f10| 20 68 65 6c 70 73 2e 20 | 4c 65 74 20 6d 65 20 6b | helps. |Let me k|
|00000f20| 6e 6f 77 20 69 66 20 49 | 20 63 61 6e 20 63 6c 65 |now if I| can cle|
|00000f30| 61 72 20 61 6e 79 74 68 | 69 6e 67 20 75 70 2e 0a |ar anyth|ing up..|
|00000f40| 0a 4b 65 76 69 6e 20 49 | 6e 67 61 6c 6c 73 2c 20 |.Kevin I|ngalls, |
|00000f50| 28 32 30 36 29 37 37 33 | 2d 39 34 30 34 2c 20 69 |(206)773|-9404, i|
|00000f60| 6e 67 6b 6c 39 30 30 40 | 63 63 6d 61 69 6c 2e 63 |ngkl900@|ccmail.c|
|00000f70| 61 2e 62 6f 65 69 6e 67 | 2e 63 6f 6d 0a 0a 0a |a.boeing|.com... |
+--------+-------------------------+-------------------------+--------+--------+